package com.cndongtai.dao.impl;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Repository;

import com.cndongtai.dao.BaseDao;
import com.cndongtai.dao.inter.LightChargeCountMapper;
import com.cndongtai.po.LightChargeCount;

@Repository("lightChargeCountDao")
public class LightChargeCountDao extends BaseDao implements
		LightChargeCountMapper {

	@Override
	public boolean addLightChargeCount(LightChargeCount lightChargeCount) {
		SqlSession sqlSession = getSqlSession();
		try {
			LightChargeCountMapper operation = sqlSession.getMapper(LightChargeCountMapper.class);
			return operation.addLightChargeCount(lightChargeCount);
		}catch(Exception e) {
			e.printStackTrace();
		}finally {
			sqlSession.close();
		}
		
		return false;
	}

	@Override
	public List<LightChargeCount> queryLightChargeCountListPage(
			Map<String, Object> parms) {
		SqlSession sqlSession = getSqlSession();
		try {
			LightChargeCountMapper operation = sqlSession.getMapper(LightChargeCountMapper.class);
			return operation.queryLightChargeCountListPage(parms);
		}catch(Exception e) {
			e.printStackTrace();
		}finally {
			sqlSession.close();
		}
		
		return null;
	}

	@Override
	public int queryLightChargeCountListCount(Map<String, Object> parms) {
		SqlSession sqlSession = getSqlSession();
		try {
			LightChargeCountMapper operation = sqlSession.getMapper(LightChargeCountMapper.class);
			
			Integer count = operation.queryLightChargeCountListCount(parms);
			return count==null?0:count;
		}catch(Exception e) {
			e.printStackTrace();
		}finally {
			sqlSession.close();
		}
		
		return 0;
	}

}
